package com.zjff.mobiletwo.dao;

import com.zjff.mobiletwo.entity.UserEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;


@Mapper
public interface UserDao {
    UserEntity getUserDetailById(int id);
    //修改账号（用户名）
    int updateUsername(String username,int id);
    //修改邮箱
    int updateEmail(String email,int id);
    //修改昵称
    int updatePname(String pname,int id);
    //修改手机号
    int updatePhone(String phone,int id);
    //增加密码
    int addPassword(String password,int id);
    //增加账号
    int addUsername(String username,int id);
    //软删除用户
    int deluser(String username);
    //添加用户
    int addUser(String username,String password,String email,String phone,String pname,int gender);

    UserEntity Sel(int id);
    //登录
    UserEntity login(String username,String password);

    String register(UserEntity user);
    //更改头像
    int upHeadImg(String avatar,int id);
    @Select("select * from zy_user where username = #{username}")
    UserEntity getUserByUsername (@Param("username") String username);
    @Select("select * from zy_user where phone = #{phone}")
    UserEntity getUserByPhone (@Param("phone") String phone);
    @Update("update zy_user set password = #{password} where username = #{username}")
    Integer updatePasswordByUsername(@Param("username")String username,@Param("password") String password);

    int addUserByPhone(String phone);


}


